package com.example.androidapp2.DbClasses;

import java.util.Calendar;
import com.xyzdesa.droidnomy.R;
import android.content.Context;
import android.graphics.Color;
import android.widget.TextView;

public class Utils {
	public static Context Ctx;

	public static String GetFecha()
	{
		Calendar c = Calendar.getInstance(); 

		String fecha = (
				((c.get(Calendar.DATE)<10)?"0"+String.valueOf( c.get(Calendar.DATE)):String.valueOf( c.get(Calendar.DATE)))+
				((c.get(Calendar.MONTH)+1<10)?"0"+String.valueOf( c.get(Calendar.MONTH)+1):String.valueOf( c.get(Calendar.MONTH)+1))+
				((c.get(Calendar.YEAR)<10)?"0"+String.valueOf( c.get(Calendar.YEAR)):String.valueOf( c.get(Calendar.YEAR)))+
				((c.get(Calendar.HOUR_OF_DAY)<10)?"0"+String.valueOf( c.get(Calendar.HOUR_OF_DAY)):String.valueOf( c.get(Calendar.HOUR_OF_DAY)))+
				((c.get(Calendar.MINUTE)<10)?"0"+String.valueOf( c.get(Calendar.MINUTE)):String.valueOf( c.get(Calendar.MINUTE)))
				);

		return fecha;
	}

	public static String GetMesAnio()
	{
		Calendar c = Calendar.getInstance();
		return ((c.get(Calendar.MONTH)+1<10)?"0"+String.valueOf( c.get(Calendar.MONTH)+1):String.valueOf( c.get(Calendar.MONTH)+1))+
				((c.get(Calendar.YEAR)<10)?"0"+String.valueOf( c.get(Calendar.YEAR)):String.valueOf( c.get(Calendar.YEAR)));		
	}

	public static String GetDefaultIngreso()
	{
		return Ctx.getResources().getString(R.string.pupIngresos);	
	}

	public static void SetControlColor(TextView ctrl, boolean positivo)
	{
		if(positivo)
			ctrl.setTextColor(Color.parseColor("#9DCD39"));
		else
			ctrl.setTextColor(Color.parseColor("#E73F2F"));
	}
}


